package com.examples.ry.layouts;

import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;

public class GridDataAllignment {

	public static void main(String[] args) {
		Display display = new Display();
		Shell shell = new Shell(display);
		GridLayout layout = new GridLayout();
		layout.numColumns = 5;
		shell.setLayout(layout);
		int[] alignment = new int[] { SWT.BEGINNING, SWT.CENTER, SWT.END,
				SWT.FILL, };
		String[] name = new String[] { "B", "C", "E", "F" };
		for (int i = 0; i < alignment.length; i++) {
			for (int j = 0; j < alignment.length; j++) {
				Button button = new Button(shell, SWT.PUSH);
				button.setText(name[i] + "," + name[j]);
				GridData data = new GridData();
				data.horizontalAlignment = alignment[i];
				data.verticalAlignment = alignment[j];
				button.setLayoutData(data);
			}
			Label label = new Label(shell, SWT.BORDER);
			GridData data = new GridData(128, 64);
			label.setLayoutData(data);
		}
		for (int i = 0; i < alignment.length; i++) {
			Label label = new Label(shell, SWT.BORDER);
			GridData data = new GridData(128, 64);
			label.setLayoutData(data);
		}
		shell.pack();
		shell.open();
		while (!shell.isDisposed()) {
			if (!display.readAndDispatch())
				display.sleep();
		}
		display.dispose();
	}

}
